package com.zst.common.utils;

public class ConvertUtils {
    public static int toInt(String val) {
        if (val == null) {
            throw new IllegalArgumentException();
        }
        return Integer.parseInt(val);
    }

    public static int toInt(String val, int defaultValue) {
        if (val == null) {
            return defaultValue;
        }
        try {
            return Integer.parseInt(val);
        } catch (Exception e) {
            return defaultValue;
        }
    }
}
